package com.ddh.service.exception;

import com.ddh.service.enum_.ResultCode;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * @author 11
 * @Description  自定义异常
 * @Date 2025/1/15  17:31
 */
@Slf4j
@Data
public class ServiceException extends RuntimeException{

    private final Integer code;

    // 构造函数，接收状态码和消息作为参数
    public ServiceException(ResultCode resultCode) {
        super(resultCode.getMessage());  // 调用父类的构造函数设置消息
        this.code = resultCode.getCode();
    }
}
